@extends('default.mobile.layouts.indexPublic')
@section('title'){{$personal_search.Site::get('area_name').'找人才|人才简历库|'.Site::get('webname')}} @endsection
{{--首页css--}}
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/mobile/index/common.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/mobile/jquery/select.css')}}">
    @endsection
    {{--头部标签--}}
    @section('tag','找人才')
    {{--主体内容--}}
    @section('content')
            <!-- B搜索框 -->
    <div class="list_search_main">
        <div class="list_search_bar">
            <form action="{{url('mobile/personnel')}}" method="post" name="jobForm" id="jobForm">
                {{csrf_field()}}
                <span><input name="keyword" id="keyword" type="text" value="{{$input['keyword'] or ''}}"
                             placeholder="意向岗位" autocomplete="off"></span>
                <span><input name="submit" class="sub" value="" type="submit"></span>
                <span><a class="clear">清除</a></span>
            </form>
        </div>
    </div>
    <!-- E搜索框 -->
    <!-- B 选择 -->
    <div class="select_outer" id="select_outer">
        <ul>
            <li id="area_select"><input type="hidden" name="jobarea1" value="{{$input['jobarea1'] or ''}}"
                                        id="jobarea1"/><a><span class="select_text">地区</span><em></em></a></li>
            <li id="work_year_select"><input type="hidden" name="work_year" value="{{$input['work_year'] or ''}}"
                                             id="work_year"/><a><span class="select_text">经验</span><em></em></a></li>
            <li id="education_select"><input type="hidden" name="education" value="{{$input['education'] or ''}}"
                                             id="education"/><a><span class="select_text">学历</span><em></em></a></li>
            <li id="sex_select"><input type="hidden" name="sex" value="{{$input['sex'] or ''}}" id="sex"/><a><span
                            class="select_text">性别</span><em></em></a></li>
        </ul>
    </div>
    <!-- E 选择 -->

    <!-- B 浏览简历-->
    <div class="main">
        <!-- B 简历列表-->
        @if(count($resumeinfo) > 0)
            <div class="list_box">
                @foreach($resumeinfo as $v)
                    <div class="list_info">
                        <a href="{{url('mobile/resume_'.idEncryption($v->id).'.html')}}">
                            <dl>
                                <dt><span class="title">
                                @if(!auth()->guard('company')->check())
                                            @if($v->sex == '1' )
                                                {{ mb_substr($v->name,0,1)}}先生
                                            @else
                                                {{ mb_substr($v->name,0,1)}}女士
                                            @endif
                                        @else
                                            {{ $v->name }}
                                        @endif
                            </span>
                                    <time>{{ $v->updatetime }}</time>
                                </dt>
                                <dd>
                                    <span class="edu">{{ $v->education }}</span>@if($v->birthday != '')<b>|</b>@endif
                                    <span class="edu">{{ $v->birthday }}</span>@if($v->work_year != '')<b>|</b>@endif
                                    <span class="edu">{{ $v->work_year }}</span>
                                </dd>
                                <dd class="line">
                                    <span class="company position">意向岗位：{{ $v->intentionjobs = str_limit($v->intentionjobs,16) }}</span>
                                    <span class="address">{{ str_limit($v->jobarea,13) }}</span>
                                </dd>
                            </dl>
                        </a>
                    </div>
                @endforeach
            </div>
        @else
            <div class="list_empty">
                <span class="norecord"></span>
                <span class="sorry">抱歉，没有找到符合您条件记录！</span>
            </div>
            @endif
                    <!-- E 简历列表-->
    </div>
    <!-- E 浏览简历-->

    <!-- B分页 -->
    <div class="page">
        @if($resumeinfo->currentPage() <= 1 )
            <a class="btn_gary previous">上一页</a>
        @else
            <a href="{{$resumeinfo->previousPageUrl()}}" class="previous">上一页</a>
        @endif
        <span><em>{{ $resumeinfo->total()== 0 ? 1 : $resumeinfo->currentPage()}}</em>/{{ $resumeinfo->lastPage() == 0 ? 1 : $resumeinfo->lastPage() }}</span>
        @if($resumeinfo->currentPage() == $resumeinfo->lastPage() || $resumeinfo->lastPage() == 0 )
            <a class="btn_gary next">下一页</a>
        @else
            <a href="{{$resumeinfo->nextPageUrl()}}" class="next">下一页</a>
        @endif
    </div>
    <!-- E分页 -->
@endsection
@section('footerjs')
    @parent
    <script type="text/javascript" src="{{asset('/default/js/mobile/jquery/jquery.select.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/mobile/jquery/jquery.select_single.js')}}"></script>
    <script type="text/javascript" src="{{Resources::jsOption('resume')}}"></script>
    <script type="text/javascript" src="{{Resources::jsProvinceArea()}}"></script>

    <script>
        var _token = '{{csrf_token()}}';
        //地区
        var jobarea_url = '{!!$optionsurl['jobarea']!!}';
        //性别
        var sex_url = '{!! $optionsurl['sex'] !!}';
        //学历
        var education_url = '{!! $optionsurl['education'] !!}';
        //有工作经验
        var work_year_url = '{!! $optionsurl['work_year'] !!}';
        //关键词
        var keyword_url = '{!! $optionsurl['keyword'] !!}';

        $(function(){
            var select_outer = $("#select_outer");
            //检查变量是不是存在
            var town = (typeof(option_town) != 'undefined') ? option_town.unshift({'value': '', 'text': '不限'}) : 0;
            var city = (typeof(option_city) != 'undefined') ? option_city.unshift({'value': '', 'text': '不限'}) : 0;
            select_outer.find("#area_select").select_single({
                select_title: '工作地区',
                hidden: '#jobarea1',
                opt_city: (city > 0) ? option_city : [],
                opt_town: (town > 0) ? option_town : [],
                opt_province: option_province,
                callback: function(val){
                    person_jump(jobarea_url, 'jobarea1', val);
                }
            });
            option_work_year.unshift({'value': '', 'text': '不限'});
            select_outer.find("#work_year_select").select({
                select_title: '工作经验',
                hidden: '#work_year',
                opt_data: option_work_year,
                callback: function(val){
                    person_jump(work_year_url, 'work_year', val);
                }
            });
            option_education.unshift({'value': '', 'text': '不限'});
            select_outer.find("#education_select").select({
                select_title: '学历',
                hidden: '#education',
                opt_data: option_education,
                callback: function(val){
                    person_jump(education_url, 'education', val);
                }
            });
            //性别
            var option_sex = [{'value': '', 'text': '不限'}, {text: '男', value: 1}, {text: '女', value: 2}];
            select_outer.find("#sex_select").select({
                select_title: '性别',
                hidden: '#sex',
                opt_data: option_sex,
                callback: function(val){
                    person_jump(sex_url, 'sex', val);
                }
            });
            //清除
            $('.list_search_main').find('.clear').click(function(){
                location.href = keyword_url;
            });
        });
        //跳转地址
        function person_jump(linkurl, define_link, val){
            var exl = "?";
            if(linkurl.indexOf("?") > 0){
                exl = '&';
            }
            location.href = linkurl + exl + define_link + '=' + val;
        }
    </script>
@endsection